import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {path: '/', redirect: '/home'},  // 重定向到主页
  { path: '/home', name: 'Home', component: () => import('../views/Home.vue') },
  { path: '/login', name: 'Login', component: () => import('../views/Login.vue') },
  { path: '/try', name: 'Try', component: () => import('../views/Try.vue')},
  { path: '/person', name: 'Person', component: () => import('../views/Person.vue'),
    children: [
      { path: '/personHome', name: 'PersonHome', component: () => import('../views/PersonHome.vue') },
      { path: '/password', name: 'Password', component: () => import('../views/Password.vue') },
      { path: '/personChange', name: 'PersonChange', component: () => import('../views/PersonChange.vue') },
      { path:'/shopping', name: 'Shopping', component: () => import('../views/Shopping.vue') },
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router